from digits import sumOfDigits

print max(sumOfDigits(x**y) for x in range(100) for y in range(100))